<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>UDT Reference</title>
</head>

<body>

<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" id="AutoNumber1" bgcolor="#99CCFF" bordercolor="#99CCFF">
  <tr>
    <td width="100%"><font face="Verdana" size="2"><i>&nbsp;UDT Reference: UDT 
	Functions</i></font></td>
  </tr>
</table>
<h1><font size="4" face="Verdana">close</font></h1>
<p><font face="Verdana" size="2">The <b>close</b> method closes the UDT entity.</font></p>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" id="AutoNumber2" bgcolor="#C0C0C0" bordercolor="#C0C0C0">
  <tr>
    <td width="100%">
    <p style="margin-top: 0; margin-bottom: 0">
    <font face="Courier New" size="1">int close(</font></p>
    <p style="margin-top: 0; margin-bottom: 0">
    <font face="Courier New" size="1">&nbsp;&nbsp; UDTSOCKET
	<font color="#FFFFFF">u</font></font></p>
    <p style="margin-top: 0; margin-bottom: 0">
    <font size="1" face="Courier New">);</font></td>
  </tr>
</table>
<h4><font face="Verdana" size="2">Parameters</font></h4>
<dl>
  <dt><i><font face="Verdana" size="2">u</font></i> </dt>
	<dd>
	<dl>
		<dt><font face="Verdana" size="2">[in] Descriptor identifying the socket 
		to close. </font></dt>
	</dl>
	</dd>
</dl>
<h4><font face="Verdana" size="2">Return Values</font></h4>
<p><font face="Verdana" size="2">On success, 0 is returned. Otherwise, UDT::ERROR 
is returned and specific error information can be retrieved by 
<a href="error.htm">getlasterror</a>.</font></p>
  <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" id="table1" bordercolordark="#C0C0C0" bordercolorlight="#C0C0C0" width="100%">
    <tr>
      <th align="center" bgcolor="#C0C0C0" width="133">
		<font face="Verdana" size="2">Error Code</font></th>
      <th align="center" bgcolor="#C0C0C0" width="812"><b>
      <font face="Verdana" size="2">Comment</font></b></th>
    </tr>
    <tr>
      <td width="133">
      <p style="margin-top: 1; margin-bottom: 1"><font face="Verdana" size="1">
		5004</font></td>
      <td width="812">
      <p style="margin-top: 1; margin-bottom: 1"><font face="Verdana" size="1">
		<i>u</i> 
		is an invalid UDT socket.</font></td>
    </tr>
    <tr>
      <td width="133">
      <p style="margin-top: 1; margin-bottom: 1"><font face="Verdana" size="1">
		6001</font></td>
      <td width="812">
      <p style="margin-top: 1; margin-bottom: 1"><font face="Verdana" size="1">
		<i>u</i> 
		is non-blocking (UDT_SNDSYN = false) but UDT_LINGER option is set to be non-zero.</font></td>
    </tr>
    </table>
<H4><font face="Verdana" size="2">Description</font></H4>
<P><font face="Verdana" size="2">The <b>close</b> method shutdowns the 
connection and releases all protocol data structures. On a blocking socket, if 
UDT_LINGER is non-zero, the close call will wait until all data in the sending 
buffer are sent out or the waiting time has exceeded the expiration time set by 
UDT_LINGER. On a non-blocking socket, close will return immediately.</font></P>
<P><font face="Verdana" size="2">The closing UDT entity will send a close 
request to its peer side (if a connection exists on the socket) so that the peer 
side will also close. However, this close information is best-effort, i.e., if 
the close request packet is lost, the peer side will not know the connection 
close until a time-out event.</font></P>
<P><font face="Verdana" size="2">All sockets should be closed if they are not 
used any more.</font></P>
<p></p>
<p></p>
<H4><font face="Verdana" size="2">See Also</font></H4>
<P><b><font face="Verdana" size="2"><a href="socket.htm">socket</a></font></b></P>

</body>

</html>